package com.example.yunJie.digitalSentry.control;


import com.example.yunJie.digitalSentry.entity.PeriodEntity;
import com.example.yunJie.digitalSentry.service.PeriodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/Period")
public class PeriodControl {

    @Autowired
    private PeriodService periodService;

    @RequestMapping("/add")
    public void  insert(PeriodEntity periodEntity){
        periodService.insert(periodEntity);
    }

    @RequestMapping("/update")
    public int update(PeriodEntity periodEntity){
        return periodService.update(periodEntity);
    }

    @RequestMapping("/deleteById")
    public int  deleteById(int id){
        return periodService.deleteById(id);
    }

    @RequestMapping("/deleteIdList")
    public int  deleteIdList(List<Integer> id){
        return periodService.deleteIdList(id);
    }

    @RequestMapping("/findId")
    public PeriodEntity  findId(String id){
        return periodService.findId(id);
    }

    @RequestMapping("/findAll")
    public List<PeriodEntity>  findAll(){
        return periodService.findAll();
    }
}
